<template>
    <div id="body">
        <div id="refresh" style="width:100%;text-align:center;"></div>
        <ul class="session" >
            <li>
                <div class="head">
                    <span>保单信息</span>
                </div>
                <ul class="list">
                    <li class="item" v-for="item in info.policyInfo">
                        <span class="item_title" v-text="item.name"></span>
                        <span class="item_content" v-text="item.content" :class="{onWaitC:item.isWait}"></span>
                    </li>
                </ul>  
            </li>
            <li v-if="info.policyAddress.length > 0">
                <div class="head">
                    <span>保单邮寄地址</span>
                </div>
                <ul class="list">
                    <li class="item" v-for="item in info.policyAddress">
                        <span class="item_title" v-text="item.name"></span>
                        <span class="item_content" v-text="item.content"></span>
                    </li>
                </ul>
            </li>
            <li v-if="info.vehicleInfo.length > 0">
                <div class="head">
                    <span>车辆信息</span>
                </div>
                <ul class="list">
                    <li class="item" v-for="item in info.vehicleInfo">
                        <span class="item_title" v-text="item.name"></span>
                        <span class="item_content" v-text="item.content"></span>
                    </li>
                </ul>
            </li>
            <li>
                <div class="head">
                    <span>投保人信息</span>
                </div>
                <ul class="list">
                    <li class="item" v-for="item in info.policyPersonInfo">
                        <span class="item_title" v-text="item.name"></span>
                        <span class="item_content" v-text="item.content"></span>
                    </li>
                </ul>
            </li>
            <li>
                <div class="head">
                    <span>被保人信息</span>
                </div>
                <ul class="list">
                    <li class="item" v-for="item in info.policyedPersonInfo">
                        <span class="item_content" v-text="item.content"></span>
                    </li>
                </ul>          
            </li>
            <li>
                <ul>
                    <li class="head">
                        <span>保障内容</span>
                    </li>
                    <li>
                        <div class="list ui-borderBottom">
                            <a :href="info.accidentInsurance" class="item ui-wh">
                                <span class="chengren_icon"></span>
                                <span class="chengren_title item_content">成人综合意外险</span>
                                <i class="iconfont xiayibu">&#xe61d;</i>
                            </a>
                        </div>
                        <div class="title">
                            <span>保险责任</span>
                        </div>
                        <div>

                        </div>
                    </li>
                </ul>
            </li>
        </ul>
        <div id="load" style="width:100%;text-align:center;"></div>
    </div>
</template>
<script>
import Refresh from 'js/refresh.js'
import Load from 'js/loadMore.js';
import axios from 'axios';
import md5 from 'md5';
import Info from '../../../static/api/orderDetail/Info';
export default {
    data () {
        return {
            isFresh: false,
            header: {
                title: '订单详情',
                back: '返回',
                close: '关闭'
            },
            info: {
                policyInfo: [
                    {name: '订单状态:', content: '等待付款', isWait: true},
                    {name: '订单号:', content: ''},
                    {name: '起保时间:', content: ''},
                    {name: '终止时间:', content: ''}
                ],
                policyPersonInfo: [
                    {name: '姓名:', content: ''},
                    {name: '证件类型:', content: ''},
                    {name: '证件号码:', content: ''},
                    {name: '手机号码:', content: ''}
                ],
                policyedPersonInfo: [
                    {name: '本人', content: '本人'}
                ],
                policyAddress: [
                    {name: '收件人:', content: '铁怪李'},
                    {name: '联系电话:', content: '098709'},
                    {name: '地址:', content: '121232321313'}
                ],
                vehicleInfo: [
                    {name: '车牌:', content: ''},
                    {name: '车主:', content: ''},
                    {name: '证件号码:', content: ''},
                    {name: '联系电话:', content: ''}
                ],
                accidentInsurance: 'productDetail.html',
                policyContent: {
                }
            }
        }
    },
    created () {
    },
    mounted () {
        // var session = document.querySelector('#body');
        // var refreshText = document.querySelector('#refresh');
        // Refresh.refreshPage(session, refreshText, this.test)
        // var loadEle = document.querySelector('#load');
        // Load.loadMore(session, loadEle, this.ttt);
        this.getData();
    },
    computed: {
    },
    methods: {
        getData () {
            let url = Info.url;
            let data = Info.data;
            let headers = Info.headers;
            axios.post(url, {
                input: data.input,
                method: data.method,
                sign: data.sign
            }, {headers})
            .then((response) => {
                var data = response.data.output;
                console.log(data)
                //
                this.info.policyInfo[0].content = data.sts;
                this.info.policyInfo[1].content = data.tradeId;
                this.info.policyInfo[2].content = data.startTime;
                this.info.policyInfo[3].content = data.endTime;
                //
                this.info.policyAddress[0].content = data.applicant;
                this.info.policyAddress[1].content = data.applicantMobile;
                this.info.policyAddress[2].content = data.orderURL;
                //
                // this.info.vehicleInfo[0].content = data.idNo;
                // this.info.vehicleInfo[1].content = data.applicantMobile;
                // this.info.vehicleInfo[2].content = data.orderURL;
                // this.info.vehicleInfo[3].content = data.orderURL;
                //
                this.info.policyPersonInfo[0].content = data.applicant;
                this.info.policyPersonInfo[1].content = data.idType;
                this.info.policyPersonInfo[2].content = data.idNo;
                this.info.policyPersonInfo[3].content = data.applicantMobile;
            })
            .catch((error) => {
                console.log(error);
            });
        },
        test () {
            setTimeout(function () {
                Refresh.reset();
            }, 1000);
        },
        ttt () {
            setTimeout(function () {
                Load.reset();
            }, 1000);
        }
    }
}
</script>
